package com.onnoa.jenkins.test.service;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.onnoa.jenkins.test.domain.SysMenu;
import com.onnoa.jenkins.test.domain.SysMenuDto;
import com.onnoa.jenkins.test.mapper.SysMenuMapper;
import com.onnoa.jenkins.test.utils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SysMenuServiceImpl implements SysMenuService{

    @Autowired
    private SysMenuMapper sysMenuMapper;

    @Override
    public List<SysMenuDto> getMenuList() {
        EntityWrapper<SysMenu> wrapper = new EntityWrapper<>();
        List<SysMenu> sysMenus = sysMenuMapper.selectList(wrapper);
        List<SysMenuDto> menuDtoList = new ArrayList<>();
        BeanUtils.copyBeanList(sysMenus, menuDtoList, SysMenuDto.class);
        return menuDtoList;
    }
}
